#ifndef GLWIDGET_H
#define GLWIDGET_H

#include "scene.h"

#include <QWidget>
#include <QGLWidget>
#include <QMouseEvent>
#include <QFile>

class GLWidget : public QGLWidget {
	Q_OBJECT

    public:
        GLWidget(QWidget* = 0);
        ~GLWidget();

        Scene *getScene();

        bool isShowingAxis() const;
        bool isShowingGrid() const;
        bool isShowingRayTest() const;
        bool isShowingCamera() const;
        bool isChangingCamera() const;

    public slots:
        void changeShowAxis(bool);
        void changeShowGrid(bool);
        void changeShowRayTest(bool);
        void changeShowCamera(bool);
        void changeChangeCamera(bool);

        void setXRotation(int);
        void setYRotation(int);
        void setZRotation(int);

        void changeObjectView(bool);

        Scene *newScene();

    private:
        void initializeGL(void);
        void paintGL(void);
        void resizeGL(int, int);
        QSize minimumSizeHint() const;
        QSize sizeHint() const;
        void wheelEvent(QWheelEvent *);
        void mousePressEvent(QMouseEvent *);
        void mouseMoveEvent(QMouseEvent *);
        void normalizeAngle(int *);

        double zoom;
        double xMov;
        double yMov;
        double zMov;
        int xRot;
        int yRot;
        int zRot;
        QPoint lastPos;

        bool showGrid;
        bool showAxis;
        bool showRayTest;
        bool showWireframeObject;
        bool showCamera;
        bool changeCamera;
//
//        GLfloat light0_pos[4];
//        GLfloat light0_ambient[4];
//        GLfloat light0_diffuse[4];
//        GLfloat light0_specular[4];
//        GLfloat global_ambient[4];

        Scene *scene;
};

#endif
